package robot

import (
	"C"
	"log"
	"time"
) 

//export goExit
func goExit() C.int {
	if CanExit() {
		return 1
	}
	return 0
}

//export goSleep
func goSleep(t C.uint) {
	time.Sleep(time.Duration(t) * time.Millisecond)
}

//export goLog
func goLog(l C.uint, id C.uint, msg *C.char) {
	flag := "INFO"
	switch l {
	case ERROR: flag = "ERROR"
	case DEBUG: flag = "DEBUG"
	case INFO: flag = "INFO"
	default: flag = "INFO"
	}

	log.Printf("[%v][%v] %v", flag, id, C.GoString(msg))
}
